[Headers deleted]

I have read on the newsnet that the Casio interface to connect to
a PC is a universal circuit. This I cannot confirm or deny, but
if it is the case the following may be of interest to other Casio
owners.

I own an FX7700 Power Graphic Calculator. I was astonished at the
cost of the 'official' Casio interface (about double the
calculator cost !!) and so began an investigation with a college.

Connection to the calculator is via a 2.5 mm stereo jack plug.
The connections are:

     /\   . Tip       :    Transmit data from calc.
     ==   . Middle    :    Receive data into calc.
     ==   . Bottom    :    0V or Ground.
    [  ]
    [__]

I made a cable up (about 1/2m length) where tip and middle are
reversed (tip of A to middle of B etc.).

In the rear of my PC I have COM2, a 25w 'D' type connector. This
was wired as per the instruction manual for the calculator.

Two problems existed.

               1)   The logic levels/polarity.
               2)   Powering the adaptor.

The first was easily solved. A MAX232 ic was used. This is
powered by a single 5V supply and generates the +/-12V signals
required by the RS232 port. On the other side of this ic it
accepts/generates TTL level signals with inverted polarity to the
RS232. This is precisely what is required by the Casio. The Maxim
ic incorporates two RS232->TTL and two TTL->RS232 adaptors, but
only one of each is used.

To power the Maxim ic I used the RTS/CTS lines which are tied
together. These generate around +12V. If memory serves I used a
series diode and small electrolytic capacitor to ensure the
supply didn't drop out. This raw +12V was passed through a 5V
regulator. Whilst this would not be recommended normally, the
power drawn by this circuit is negligible, even when
communicating.

The above cicuit was built onto a tiny proto-board and fitted
inside the 'D' type back shell, with just a 2.5mm stereo jack
socket protruding from the rear.

As regards software, I have a programme written in Microsoft
Quick Basic. This is sufficiently fast to allow comms at the
highest baud rate of the calculator.

There are two protocols for data transfer, single programmes or
block mode (all programmes stored within the calculator). I only
implemented the first.

In the following, Tx is the calculator and Rx the PC. All data is
decimal.

When you press the send key on the calculator the following
happens in the single programme transfer mode.

1)   Tx sends 22 and waits a short time. Rx responds with 19 if
     ready. If no response is received the Tx displays an error
     message.

2)   If Rx responds correctly Tx then sends a header block of 40
     characters. A checksum is calculated on this block. This
     should add to 58. If not an error has occurred and Rx sends
     43, else 6.

Note: When sending from PC to calculator if the slot in the
     calculator is full then it responds to the header block
     with 33 instead of the usual 6 or 43. In this situation
     the PC must ask the user to continue or not. If not the PC
     sends 21 otherwise 6.

3)   Assuming no checksum error the programme length is
     calculated from the 5th and 6th bytes of the header block.
     Length is 256*5th byte + 6th byte. Rx now receives this many
     bytes, the programme. A checksum is performed on this data,
     with the same assumptions on result and messages between Rx
     and Tx.

When sending from PC to calculator, the PC simply calculates the
header block as follows.

       Byte No.          Data
          1              58
          2              80
          3              49 + slot number (programme memory no.)
          4              00
          5              High byte of prog length
          6              Low byte of prog length
          7              00
          8              00
          9-39           255
          40             Checksum byte

Bytes 4,7 and 8 are not known, but are believed to relate to the
calculator mode the programme is operating in. (eg Matrix,
Regression etc.)

For simply storing and retrieving programmes on a computer this
information is not required.

However. The calculator only allows upper case characters to be
typed. The character set contains ALL ASCII characters, so a
programme could be written/modified on your PC and then
downloaded to the calculator with lower case characters (or
indeed other ASCIIs) for a 'different' look. This would require
the checksum to be recalculated for the programme, and if the
programme length changed the header would also need modification.

Hope this is of use to the interested parties.

Bob
